<template>
  <header class="nav">
    <div class="nav-inner">
      <router-link to="/" class="brand" aria-label="意数未来官网">
        <div class="brand-content">
          <!-- SVG Logo -->
          <svg class="brand-logo" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
            <path d="M12 2L2 7L12 12L22 7L12 2Z" fill="url(#brand-gradient)"/>
            <path d="M2 17L12 22L22 17" stroke="url(#brand-gradient)" stroke-width="2"/>
            <path d="M2 12L12 17L22 12" stroke="url(#brand-gradient)" stroke-width="2"/>
            <defs>
              <linearGradient id="brand-gradient" x1="0%" y1="0%" x2="100%" y2="100%">
                <stop offset="0%" stop-color="var(--brand-primary)"/>
                <stop offset="100%" stop-color="var(--brand-secondary)"/>
              </linearGradient>
            </defs>
          </svg>
          <!-- Brand Name -->
          <strong class="brand-name">意数未来</strong>
        </div>
      </router-link>
      <nav>
        <router-link :class="linkClass('/')" to="/">首页</router-link>
        <router-link :class="linkClass('/about')" to="/about">公司简介</router-link>
        <router-link :class="linkClass('/services')" to="/services">产品与服务</router-link>
        <router-link :class="linkClass('/contact')" to="/contact">联系我们</router-link>
      </nav>
    </div>
  </header>
</template>

<script setup lang="ts">
import { useRoute } from 'vue-router';
const route = useRoute();
const linkClass = (path: string) => ({ active: route.path === path });
</script>

<style scoped>
.nav {
  padding: var(--spacing-sm) 0;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-inner {
  width: min(1120px, 92vw);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
}

.brand-content {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.brand-logo {
  width: 32px;
  height: 32px;
  transition: transform 0.3s ease;
}

.brand-name {
  font-size: 1.5rem;
  font-weight: 700;
  background: var(--brand-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  transition: all 0.3s ease;
}

.brand:hover .brand-logo {
  transform: scale(1.1);
}

nav {
  display: flex;
  gap: var(--spacing-md);
}

nav a {
  padding: var(--spacing-xs) var(--spacing-sm);
  border-radius: var(--radius-sm);
  font-weight: 500;
  position: relative;
}

nav a:hover {
  color: var(--brand-primary);
  background-color: rgba(14, 165, 233, 0.05);
}

nav a.active {
  color: var(--brand-primary);
  font-weight: 600;
}

nav a.active::after {
  content: '';
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  width: 16px;
  height: 2px;
  background: var(--brand-gradient);
  border-radius: 1px;
}

/* Responsive styles */
@media (max-width: 768px) {
  .nav-inner {
    flex-direction: column;
    gap: var(--spacing-md);
  }
  
  nav {
    flex-wrap: wrap;
    justify-content: center;
  }
  
  .brand-name {
    font-size: 1.35rem;
  }
}
</style>